#include <iostream>
using namespace std;

void merge(int a[], int alen, int b[], int blen) {
	int len = alen + blen;
	
	while (alen>0 && blen>0) {
		if (a[alen-1] > b[blen-1]) {
			a[len-1] = a[alen-1];
			alen--;
		}
		else {
			a[len-1] = b[blen-1];
			blen--;
		}

		len--;
	}

	while (alen > 0) {
		a[len-1] = a[alen-1];
		len--;
		alen--;
	}	
	
	while (blen > 0) {
		a[len-1] = b[blen-1];
		len--;
		blen--;
	}
}

//int main() {
//	int a[10] = {0,2,4,6};
//	int b[4]  = {1,3,5,7};
//
//	merge(a, 4, b, 4);
//	return 0;
//}